UNIT ESCREVER;

Interface

uses


Crt,Dos,Printer,Graph,ADC,EXTDR,GlobVar,
CalNVC,printgraf,escreva,show,LeCelula,graveArquivo;

var OldChoice  :  char;
    var  g:real;

Procedure FixaLatencia(x  :  integer);
Procedure FixaLatenciaD(x  :  integer);
Procedure FixaAmplitude(x  :  integer);
Procedure FixaDuracao(x  :  integer);
Procedure FixaDistancia;

Implementation

Procedure FixaDistancia;

const
space =8;

var
   jj,ii    :    integer;
   code,Num1  :    integer;
   strg        :    string[80];
   final      :    boolean;
   Posi       :    integer;

begin
     XI:=3;
     YJ:=Imem;
     AjustaTamanho;
     posi:=0;
     final:=false;
     MovecellD;
      if nervou.distancia[YJ]<>0.0 then
           begin
           strg:=nervou.dados[XI,YJ];
           posi:=Length(strg)*space-5;
           end
           else begin
           strg:='';
           Posi:=0;
        end;
     repeat
     setfillstyle(1,6);
     repeat
     setcolor(15);
     OutTextXY(Posi+space,2,'_');
     delay(50);
     setcolor(6);
     OutTextXY(Posi+space,2,'_');
     delay(50);
     until keypressed;
     setcolor(15);
     ch:=readkey;
     if ch<>#0 then
     begin
     case ch of
         #13     : begin
                     final:=true;
                   end;
    '0'..'9','.' : begin
                     strg:=Strg+ch;
                     if Posi<(tamanho-12) then
                     begin
                     Posi:=Posi+space;
                     OutTextXY(Posi,0,ch);
                 end
               else begin
                  beep;
                  bar(posi,0,posi+8,10);
                  OutTextXY(Posi,0,ch);
                end;
                end;
         end; {case}
    end else begin
    ch:=readkey;
     case ch of
      DArr    :  begin
                   nervou.Dados[XI,YJ]:=strg;
                   If entradaNumerica then
                   Val(strg,nervou.distancia[YJ],code);
                   ApagaCell(CXPos[XI],CYPos[YJ],Tamanho);
                   MovecellDw;
                    if nervou.distancia[YJ]<>0.0 then
                     begin
                       strg:=nervou.dados[XI,YJ];
                       posi:=space*length(strg)-5;
                     end
                   else begin
                         strg:='';
                         Posi:=0;
                   end;
                 end;
      UArr    :  begin
                   nervou.Dados[XI,YJ]:=strg;
                   If entradaNumerica then
                   Val(strg,nervou.distancia[YJ],code);
                   ApagaCell(CXPos[XI],CYPos[YJ],Tamanho);
                   MovecellUp;
                   if nervou.distancia[YJ]<>0.0 then
                     begin
                       strg:=nervou.dados[XI,YJ];
                       posi:=length(strg)*space-5;
                     end
                   else begin
                         strg:='';
                         Posi:=0;
                   end;
                 end;
       #83       :  begin
                         setfillstyle(1,6);
                         bar(posi,0,posi+8,10);
                         If Length(strg)>0 then begin
                         strg:=copy(strg,1,length(strg)-1);
                         If Posi>0 then Posi:=Posi-space else posi:=0;
                         If XI=3 then FillChar(nervou.esp[YJ],1,strg[1]);
                         end;
                          If entradaNumerica then
                          Val(strg,nervou.distancia[YJ],code);
                     end;
      #13     :  final:=true;
      end;{case}
     end;
      until final;
      nervou.Dados[XI,YJ]:=strg;
      If entradaNumerica then
      Val(strg,nervou.distancia[YJ],code);
      ApagaCell(CXPos[XI],CYPos[YJ],Tamanho);
      setcolor(15);
      setfillstyle(1,0);
      setviewPort(InitX,InitY,FinX,FinY,True);
 end;

Procedure FixaLatencia(x  :  integer);

begin

  setFillStyle(0,0);
  setviewport(0,0,getMaxX,GetMaxY,true);

   WriteText(PosX+35+hx,pos2Y+PosY2janCont+hh+(x)*h,real2Str(v*EscX[IescX]/25));

   ch:=readkey;

     case ch of
         'b'    : begin
                     nervou.Mem[1648,Imem]:=3000;
                     {buffer[u+1648]:=3000;}
                   end;
         'a'    : begin
                     nervou.Mem[1648,Imem]:=5000;
                     {buffer[u+1648]:=5000;}
                  end
         else begin
                nervou.Mem[1648,Imem]:=10000;{case}
                {buffer[u+1648]:=10000;}
              end;
     end;
            case nervou.mem[1648,imem] of
              3000     :  setcolor(3);
              5000     :  setcolor(4);
              10000    :  setcolor(15);
            end;

  WriteT(PosX+35+hx,pos2Y+PosY2janCont+hh+(x)*h,real2Str(v*EscX[IescX]/25));
  nervou.MemI[Imem,1]:=v*EscX[IescX]/25+0.001;
  setFillStyle(0,1);
  setcolor(15);
end;


Procedure FixaLatenciaD(x  :  integer);

begin
  setFillStyle(0,0);
  WriteText(PosX+35+hx,pos2Y+PosY2janCont+hh+(x)*h,real2Str(XO*EscX[IescX]/25));
   ch:=readkey;

     case ch of
         'b'    : begin
                     nervou.Mem[1648,Imem]:=3000;
                     {buffer[u+1648]:=3000;}
                   end;
         'a'    : begin
                     nervou.Mem[1648,Imem]:=5000;
                     {buffer[u+1648]:=5000;}
                  end
         else begin
               nervou.Mem[1648,Imem]:=10000;
               {buffer[u+1648]:=10000;}{case}
              end;
     end;



            case nervou.mem[1648,Imem] of
              3000     :  setcolor(3);
              5000     :  setcolor(4);
              10000    :  setcolor(15);
            end;
   WriteT(PosX+35+hx,pos2Y+PosY2janCont+hh+(x)*h,real2Str(g+XO*EscX[IescX]/25));
   ch:=readkey;
   nervou.MemI[Imem,1]:=v*EscX[IescX]/25+0.001;
   setFillStyle(0,1);
   setcolor(15);
   nervou.MemI[Imem,1]:=XO*EscX[IescX]/25;
end;

Procedure FixaDuracao(x  :  integer);

begin
  setFillStyle(0,0);
  WriteText(PosX+150+hx,pos2Y+PosY2janCont+hh+(x)*h,real2str(DeltaXO));

   ch:=readkey;
   if ch=' ' then ch:=readkey;

     case ch of
         'b'    : begin
                     {buffer[u+1649]:=3000;}
                     nervou.mem[1649,Imem]:=3000;
                   end;
         'a'    : begin
                    { buffer[u+1649]:=5000;}
                     nervou.mem[1649,Imem]:=5000;
                  end
         else begin
               {buffer[u+1649]:=10000;}{case}
               nervou.mem[1649,Imem]:=10000;
              end;
     end;
            case nervou.mem[1649,imem] of
              3000     :  setcolor(3);
              5000     :  setcolor(4);
              10000    :  setcolor(15);
            end;
  WriteT(PosX+150+hx,pos2Y+PosY2janCont+hh+(x)*h,real2str(DeltaXO));
  {nervou.MemI[Imem,1]:=v*EscX[IescX]/25+0.001;}
  setFillStyle(0,1);
  setcolor(15);
  nervou.MemI[Imem,3]:=DeltaXO;
  setFillStyle(0,1);
end;

Procedure FixaAmplitude(x  :  integer);

begin
   SetViewPort(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,PosX+90+hx+60,pos2Y+hh+PosY2janCont+(x)*h,ClipOff);
   bar(0,0,30,9);
  SetViewPort(InitX,InitY,FinX,FinY,clipOn);
       case IescY of
        1..3  :  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'uV')
                    else  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'mV');
      end;
  If deltaYO>0.001 then nervou.MemI[Imem,2]:=DeltaYO else nervou.MemI[Imem,2]:=0.002;


   ch:=readkey;

     case ch of
         'b'    : begin
                     nervou.Mem[1647,Imem]:=3000;
                   end;
         'a'    : begin
                     nervou.Mem[1647,Imem]:=5000;
                  end
         else nervou.Mem[1647,Imem]:=10000;{case}
     end;
            case nervou.mem[1647,imem] of
              3000     :  setcolor(3);
              5000     :  setcolor(4);
              10000    :  setcolor(15);
            end;



   SetViewPort(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,PosX+90+hx+60,pos2Y+hh+PosY2janCont+(x)*h,ClipOff);
     bar(0,0,30,9);
  SetViewPort(InitX,InitY,FinX,FinY,clipOn);
       case IescY of
        1..3  :  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'uV')
                    else  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'mV');
      end;
  If deltaYO>0.001 then nervou.MemI[Imem,2]:=DeltaYO else nervou.MemI[Imem,2]:=0.002;
  setFillStyle(0,1);
  setcolor(15);
end;


end.